package org.cbg.btn;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;

import javax.swing.SwingConstants;

import org.cbg.bean.SearchGoodsBean;
import org.cbg.bean.SearchOrderBean;
import org.cbg.entity.Message;
import org.cbg.frame.TrslationMainJframe;
import org.cbg.panel.TraslationWantBuyDaojuJpanel;
import org.cbg.panel.TraslationWantBuyGongshiqiJpanel;
import org.cbg.panel.TraslationWantBuyJpanel;
import org.cbg.panel.TraslationWantBuyLingbaoJpanel;
import org.cbg.panel.TraslationWantBuyShouyeCardJpanel;
import org.cbg.panel.TraslationWantBuyShouyeJpanel;
import org.cbg.panel.TraslationWantBuyShouyeSousuojieguoJpanel;
import org.cbg.panel.TraslationWantBuyZhaohuanshouJpanel;
import org.cbg.panel.TraslationWantBuyZhaungbeiJpanel;
import org.cbg.panel.TrslationTreasurepavilionJpanel;
import org.come.Frame.ZhuFrame;
import org.come.Jpanel.BoothBoxJpanel;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.CutButtonImage;
import org.come.until.GsonUtil;

import com.tool.btn.MoBanBtn;
import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;



public class TrslationMainBtn extends MoBanBtn {

    /**
     * 1我要买 2我要卖 3我的藏宝阁 4消息 5首页，6大话币，7道具，8召唤兽，9装备，10灵宝，11公示期，12收藏 13左下拉框 14右下拉框
     * 15搜索按钮 16返回 17首页 18 上一页 19下一页 20 末页 30出售，31收购 32召唤兽按钮 33灵宝按钮
     * */
    private int caozuo;

    private TrslationTreasurepavilionJpanel trslationTreasurepavilionJpanel;
    private TraslationWantBuyJpanel traslationWantBuyJpanel;

    private TraslationWantBuyShouyeJpanel traslationWantBuyShouyeJpanel;
    private TraslationWantBuyShouyeSousuojieguoJpanel traslationWantBuyShouyeSousuojieguoJpanel;

    // private BoothBoxMainJpanel boothBoxMainJpanel;

    private BoothBoxJpanel boothBoxJpanel;

    public TrslationMainBtn(String iconpath, int type, int caozuo, String text,
                            TraslationWantBuyShouyeSousuojieguoJpanel traslationWantBuyShouyeSousuojieguoJpanel) {

        super(iconpath, type);
        this.caozuo = caozuo;
        this.traslationWantBuyShouyeSousuojieguoJpanel = traslationWantBuyShouyeSousuojieguoJpanel;
        setText(text);
        setFont(UIUtils.TEXT_HY14);
        setForeground(Color.white);
        setVerticalTextPosition(SwingConstants.CENTER);
        setHorizontalTextPosition(SwingConstants.CENTER);
    }


    public TrslationMainBtn(String iconpath, int type, Color[] colors, Font font, int caozuo, String text,
                            TraslationWantBuyShouyeSousuojieguoJpanel traslationWantBuyShouyeSousuojieguoJpanel) {

        super(iconpath, type, colors);
        this.caozuo = caozuo;
        this.traslationWantBuyShouyeSousuojieguoJpanel = traslationWantBuyShouyeSousuojieguoJpanel;
        setText(text);
        setFont(font);
        setVerticalTextPosition(SwingConstants.CENTER);
        setHorizontalTextPosition(SwingConstants.CENTER);
    }


    public TrslationMainBtn(String iconpath, int type, int caozuo,
                            TrslationTreasurepavilionJpanel trslationTreasurepavilionJpanel) {
        super(iconpath, type);
        // TODO Auto-generated constructor stub
        this.caozuo = caozuo;
        this.trslationTreasurepavilionJpanel = trslationTreasurepavilionJpanel;
    }


//    图片解密




    public TrslationMainBtn(String iconpath, int type, int caozuo, TraslationWantBuyJpanel traslationWantBuyJpanel) {
        super(iconpath, type);
        // TODO Auto-generated constructor stub
        this.caozuo = caozuo;
        this.traslationWantBuyJpanel = traslationWantBuyJpanel;
    }




    public TrslationMainBtn(String iconpath, int type, int caozuo, String text,
                            TraslationWantBuyShouyeJpanel traslationWantBuyShouyeJpanel) {
        super(iconpath, type);
        // TODO Auto-generated constructor stub
        this.caozuo = caozuo;
        setText(text);
        setVerticalTextPosition(SwingConstants.CENTER);
        setFont(UIUtils.TEXT_HY16);
        setHorizontalTextPosition(SwingConstants.CENTER);
        this.traslationWantBuyShouyeJpanel = traslationWantBuyShouyeJpanel;

    }


    // public TrslationMainBtn(String iconpath, int type , int caozuo ,String
    // text, BoothBoxMainJpanel boothBoxMainJpanel) {
    // super(iconpath, type);
    // // TODO Auto-generated constructor stub
    // this.caozuo = caozuo;
    // setText(text);
    // setFont(UIUtils.TEXT_HY16);
    // setVerticalTextPosition(JLabel.CENTER);
    // setHorizontalTextPosition(JLabel.CENTER);
    // this.boothBoxMainJpanel = boothBoxMainJpanel;
    //
    // }




    @Override
    public void chooseyes() {
        // TODO Auto-generated method stub

    }

    @Override
    public void chooseno() {
        // TODO Auto-generated method stub

    }

    @Override
    public void nochoose(MouseEvent e) {
        // TODO Auto-generated method stub
        String sendmes;
        SearchGoodsBean searchGoodsBean = new SearchGoodsBean();

        try {
            switch (caozuo) {
                case 1:
                    trslationTreasurepavilionJpanel.getIwantbuy().setIcons(CutButtonImage.cuts("inkImg/number/b4/wyma.png"));
                    trslationTreasurepavilionJpanel.getIwantsent().setIcons(CutButtonImage.cuts("inkImg/number/b4/wymb1.png"));
                    trslationTreasurepavilionJpanel.getIcangbaoge().setIcons(CutButtonImage.cuts("inkImg/number/b4/wdcbg1.png"));
                    trslationTreasurepavilionJpanel.getImes().setIcons(CutButtonImage.cuts("inkImg/number/b4/xx1.png"));
                    trslationTreasurepavilionJpanel.getTranslationMainCardJpanel().getCardLayout()
                            .show(trslationTreasurepavilionJpanel.getTranslationMainCardJpanel(), "iwantbuy");

                    if (TrslationMainJframe.getTrslationMainJframe().getPanelOpen() == 0) {
                        /**
                         * 将搜索信息传给服务器 1、初始化协议 2、修改搜索类型(0、首页最新上架页面 1、首页 2、大话币 3、道具
                         * 4、召唤兽 5、装备 6、灵宝 7、公示期 8、收藏 9、我要卖之已寄售品) 3、搜索条件 4、当前页码
                         * 5、搜索内容 6、转换为json字符串 7、上传给服务器
                         */
                        searchGoodsBean.setSaletype(1);
                        searchGoodsBean.setPageNum(1);
                        sendmes = Agreement.getAgreement().searchGoodsAgreement(
                                GsonUtil.getGsonUtil().getgson().toJson(searchGoodsBean));
                        SendMessageUntil.toServer(sendmes);
                        TrslationMainJframe.getTrslationMainJframe().setPanelOpen(0);
                    }

                    break;
                case 2:
                    trslationTreasurepavilionJpanel.getIwantbuy().setIcons(CutButtonImage.cuts("inkImg/number/b4/wyma1.png"));
                    trslationTreasurepavilionJpanel.getIwantsent().setIcons(CutButtonImage.cuts("inkImg/number/b4/wymb.png"));
                    trslationTreasurepavilionJpanel.getIcangbaoge().setIcons(CutButtonImage.cuts("inkImg/number/b4/wdcbg1.png"));
                    trslationTreasurepavilionJpanel.getImes().setIcons(CutButtonImage.cuts("inkImg/number/b4/xx1.png"));

                    trslationTreasurepavilionJpanel.getTranslationMainCardJpanel().getCardLayout()
                            .show(trslationTreasurepavilionJpanel.getTranslationMainCardJpanel(), "iwantsent");

                    break;
                case 3:
                    trslationTreasurepavilionJpanel.getIwantbuy().setIcons(CutButtonImage.cuts("inkImg/number/b4/wyma1.png"));
                    trslationTreasurepavilionJpanel.getIwantsent().setIcons(CutButtonImage.cuts("inkImg/number/b4/wymb1.png"));
                    trslationTreasurepavilionJpanel.getIcangbaoge().setIcons(CutButtonImage.cuts("inkImg/number/b4/wdcbg.png"));
                    trslationTreasurepavilionJpanel.getImes().setIcons(CutButtonImage.cuts("inkImg/number/b4/xx1.png"));

                    trslationTreasurepavilionJpanel.getTranslationMainCardJpanel().getCardLayout()
                            .show(trslationTreasurepavilionJpanel.getTranslationMainCardJpanel(), "icangbaoge");

                    if (trslationTreasurepavilionJpanel.getTranslationMainCardJpanel().getTraslationMyMainJpanel().getTraslationMyMainCardJpanel().getTraslationMyMainMyorderJpanel()
                            .isVisible()) {
                        /**
                         * 传递数据获取我的藏宝阁指定购买中的数据信息 1、初始化SearchOrderBean对象
                         * 2、SearchOrderBean对象获取角色ID 3、SearchOrderBean对象获取订单状态(1未付钱
                         * ，2超时 ， 3已付钱 ，4已取货 5、所有订单) 4、SearchOrderBean对象获取查询时间(1、一周内
                         * 2、一个月内 3、一个月前) 5、SearchOrderBean对象获取当前页数(点击我的订单按钮页数默认为1)
                         * 6、SearchOrderBean对象转换为对应协议的json对象 7、发送给服务器处理数据信息
                         */

                        SearchOrderBean searchOrderBean = new SearchOrderBean();
                        searchOrderBean.setTime(1);
                        searchOrderBean.setPageNum(1);
                        sendmes = Agreement.getAgreement().searchMyOrderAgreement(
                                GsonUtil.getGsonUtil().getgson().toJson(searchOrderBean));
                        SendMessageUntil.toServer(sendmes);

                    }

                    break;
                case 4:
                    trslationTreasurepavilionJpanel.getIwantbuy().setIcons(CutButtonImage.cuts("inkImg/number/b4/wyma1.png"));
                    trslationTreasurepavilionJpanel.getIwantsent().setIcons(CutButtonImage.cuts("inkImg/number/b4/wymb1.png"));
                    trslationTreasurepavilionJpanel.getIcangbaoge().setIcons(CutButtonImage.cuts("inkImg/number/b4/wdcbg1.png"));
                    trslationTreasurepavilionJpanel.getImes().setIcons(CutButtonImage.cuts("inkImg/number/b4/xx.png"));

                    /**
                     * 取出当前角色Id
                     */

                    BigDecimal roleid = RoleData.getRoleData().getLoginResult().getRole_id();
                    /**
                     * 消息初始化 上传角色Id 上传页码 转换为对应协议头的json对象 发送信息
                     */
                    Message message = new Message();
                    sendmes = Agreement.getAgreement().searchNewsAgreement(1 + "");
                    SendMessageUntil.toServer(sendmes);
                    break;
                case 5:
                    traslationWantBuyJpanel.getShouye().setIcons(CutButtonImage.cuts("inkImg/number/b4/B01.png"));
                    traslationWantBuyJpanel.getDahuabi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B02a.png"));
                    traslationWantBuyJpanel.getDaoju().setIcons(CutButtonImage.cuts("inkImg/number/b4/B03a.png"));
                    traslationWantBuyJpanel.getZhaohuansou().setIcons(CutButtonImage.cuts("inkImg/number/b4/B04a.png"));
                    traslationWantBuyJpanel.getZhuangbei().setIcons(CutButtonImage.cuts("inkImg/number/b4/B05a.png"));
                    traslationWantBuyJpanel.getLingbao().setIcons(CutButtonImage.cuts("inkImg/number/b4/B06a.png"));
                    traslationWantBuyJpanel.getGongshiqi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B07a.png"));
                    traslationWantBuyJpanel.getShoucang().setIcons(CutButtonImage.cuts("inkImg/number/b4/B08a.png"));
                    traslationWantBuyJpanel.changeOrder();

                    /**
                     * 将搜索信息传给服务器 1、初始化协议 2、修改搜索类型(0、首页最新上架页面 1、首页 2、大话币 3、道具 4、召唤兽
                     * 5、装备 6、灵宝 7、公示期 8、收藏 9、我要卖之已寄售品) 3、搜索条件 4、当前页码 5、搜索内容
                     * 6、转换为json字符串 7、上传给服务器
                     */
                    searchGoodsBean.setSaletype(1);
                    // searchGoodsBean.setContiontype("");

                    searchGoodsBean.setPageNum(1);
                    // searchGoodsBean.setSalename("");
                    sendmes = Agreement.getAgreement().searchGoodsAgreement(
                            GsonUtil.getGsonUtil().getgson().toJson(searchGoodsBean));
                    SendMessageUntil.toServer(sendmes);
                    TrslationMainJframe.getTrslationMainJframe().setPanelOpen(0);

                    // traslationWantBuyCardJapel.getCardLayout().show(traslationWantBuyCardJapel,
                    // "shouye");

                    break;

                case 6:
                    traslationWantBuyJpanel.getShouye().setIcons(CutButtonImage.cuts("inkImg/number/b4/B01a.png"));
                    traslationWantBuyJpanel.getDahuabi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B02.png"));
                    traslationWantBuyJpanel.getDaoju().setIcons(CutButtonImage.cuts("inkImg/number/b4/B03a.png"));
                    traslationWantBuyJpanel.getZhaohuansou().setIcons(CutButtonImage.cuts("inkImg/number/b4/B04a.png"));
                    traslationWantBuyJpanel.getZhuangbei().setIcons(CutButtonImage.cuts("inkImg/number/b4/B05a.png"));
                    traslationWantBuyJpanel.getLingbao().setIcons(CutButtonImage.cuts("inkImg/number/b4/B06a.png"));
                    traslationWantBuyJpanel.getGongshiqi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B07a.png"));
                    traslationWantBuyJpanel.getShoucang().setIcons(CutButtonImage.cuts("inkImg/number/b4/B08a.png"));
                    traslationWantBuyJpanel.changeOrder();
                    /**
                     * 将搜索信息传给服务器 1、初始化协议 2、修改搜索类型(0、首页最新上架页面 1、首页 2、大话币 3、道具 4、召唤兽
                     * 5、装备 6、灵宝 7、公示期 8、收藏 9、我要卖之已寄售品) 3、 4、确认页码 5、搜索条件的整合
                     * 6、转换为json字符串 7、上传给服务器
                     */
                    searchGoodsBean.setSaletype(2);
                    searchGoodsBean.setContiontype("100000000-10000000000");
                    TrslationMainJframe.getTrslationMainJframe().getTrslationMainJpanel().getTranslationMainCardJpanel()
                            .getTraslationWantBuyJpanel().getTraslationWantBuyCardJapel()
                            .getTraslationWantBuyDahuabiJpanel().setDangqianyeshu(1);
                    searchGoodsBean.setPageNum(1);
                    sendmes = Agreement.getAgreement().searchGoodsAgreement(
                            GsonUtil.getGsonUtil().getgson().toJson(searchGoodsBean));
                    SendMessageUntil.toServer(sendmes);
                    TrslationMainJframe.getTrslationMainJframe().setPanelOpen(2);

                    /**
                     * 展示页面面板（最后要注释掉）
                     */
                    // traslationWantBuyCardJapel.getCardLayout().show(
                    // traslationWantBuyCardJapel, "dahuabi");

                    break;

                case 7:
                    traslationWantBuyJpanel.getShouye().setIcons(CutButtonImage.cuts("inkImg/number/b4/B01a.png"));
                    traslationWantBuyJpanel.getDahuabi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B02a.png"));
                    traslationWantBuyJpanel.getDaoju().setIcons(CutButtonImage.cuts("inkImg/number/b4/B03.png"));
                    traslationWantBuyJpanel.getZhaohuansou().setIcons(CutButtonImage.cuts("inkImg/number/b4/B04a.png"));
                    traslationWantBuyJpanel.getZhuangbei().setIcons(CutButtonImage.cuts("inkImg/number/b4/B05a.png"));
                    traslationWantBuyJpanel.getLingbao().setIcons(CutButtonImage.cuts("inkImg/number/b4/B06a.png"));
                    traslationWantBuyJpanel.getGongshiqi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B07a.png"));
                    traslationWantBuyJpanel.getShoucang().setIcons(CutButtonImage.cuts("inkImg/number/b4/B08a.png"));
                    traslationWantBuyJpanel.changeOrder();

                    /**
                     * 将搜索信息传给服务器 1、初始化协议 2、修改搜索类型(0、首页最新上架页面 1、首页 2、大话币 3、道具 4、召唤兽
                     * 5、装备 6、灵宝 7、公示期 8、收藏 9、我要卖之已寄售品) 3、确认是否有二级搜索( 1 全部 2 召唤兽装备 3
                     * 地煞星符 4 宝石 5 召唤兽饰品 6 孩子装备 7 其它 8 1-14称 9 特殊召唤兽 10 高级守护 11 神兽
                     * 12 常规装备 13 神兵 14 仙器 15 配饰 16 护身符 17 灵宝 18 符石 19 道具类 20 召唤兽类
                     * 21 装备类 22 灵宝类 0 没有二级分类 ) 4、搜索条件的整合 5、转换为json字符串 6、上传给服务器
                     */
                    searchGoodsBean.setSaletype(3);
                    searchGoodsBean.setContiontype("0");// 根据第一个下拉框改变
                    TraslationWantBuyDaojuJpanel.getTraslationWantBuyDaojuJpanel().setDangqianyeshu(1);
                    searchGoodsBean.setPageNum(1);
                    // searchGoodsBean.setSalename("");
                    sendmes = Agreement.getAgreement().searchGoodsAgreement(
                            GsonUtil.getGsonUtil().getgson().toJson(searchGoodsBean));
                    SendMessageUntil.toServer(sendmes);
                    TrslationMainJframe.getTrslationMainJframe().setPanelOpen(3);

                    // 重置下拉框
                    TraslationWantBuyDaojuJpanel.getTraslationWantBuyDaojuJpanel().getChooseLeft().setText("全部");

                    /**
                     * 展示页面面板（最后要注释掉）
                     */
                    // traslationWantBuyCardJapel.getCardLayout().show(
                    // traslationWantBuyCardJapel, "daoju");

                    break;

                case 8:
                    traslationWantBuyJpanel.getShouye().setIcons(CutButtonImage.cuts("inkImg/number/b4/B01a.png"));
                    traslationWantBuyJpanel.getDahuabi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B02a.png"));
                    traslationWantBuyJpanel.getDaoju().setIcons(CutButtonImage.cuts("inkImg/number/b4/B03a.png"));
                    traslationWantBuyJpanel.getZhaohuansou().setIcons(CutButtonImage.cuts("inkImg/number/b4/B04.png"));
                    traslationWantBuyJpanel.getZhuangbei().setIcons(CutButtonImage.cuts("inkImg/number/b4/B05a.png"));
                    traslationWantBuyJpanel.getLingbao().setIcons(CutButtonImage.cuts("inkImg/number/b4/B06a.png"));
                    traslationWantBuyJpanel.getGongshiqi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B07a.png"));
                    traslationWantBuyJpanel.getShoucang().setIcons(CutButtonImage.cuts("inkImg/number/b4/B08a.png"));
                    traslationWantBuyJpanel.changeOrder();

                    /**
                     * 将搜索信息传给服务器 1、初始化协议 2、修改搜索类型(0、首页最新上架页面 1、首页 2、大话币 3、道具 4、召唤兽
                     * 5、装备 6、灵宝 7、公示期 8、收藏 9、我要卖之已寄售品) 3、确认是否有二级搜索( 1 全部 2 召唤兽装备 3
                     * 地煞星符 4 宝石 5 召唤兽饰品 6 孩子装备 7 其它 8 1-14称 9 特殊召唤兽 10 高级守护 11 神兽
                     * 12 常规装备 13 神兵 14 仙器 15 配饰 16 护身符 17 灵宝 18 符石 19 道具类 20 召唤兽类
                     * 21 装备类 22 灵宝类 0 没有二级分类 ) 4、上传当前页数 5、搜索条件的整合 6、转换为json字符串
                     * 7、上传给服务器 8、设置当前打开页
                     */
                    searchGoodsBean.setSaletype(4);
                    searchGoodsBean.setContiontype("0");// 根据第一个下拉框改变
                    // searchGoodsBean.setSalename("全部召唤兽=全部召唤兽||不限变色=不限变色");
                    TraslationWantBuyZhaohuanshouJpanel.getTraslationWantBuyZhaohuanshouJpanel().setDangqianyeshu(1);
                    searchGoodsBean.setPageNum(1);
                    sendmes = Agreement.getAgreement().searchGoodsAgreement(
                            GsonUtil.getGsonUtil().getgson().toJson(searchGoodsBean));
                    SendMessageUntil.toServer(sendmes);
                    TrslationMainJframe.getTrslationMainJframe().setPanelOpen(4);

                    // 重置下拉框
                    TraslationWantBuyZhaohuanshouJpanel.getTraslationWantBuyZhaohuanshouJpanel().getChooseLeft()
                            .setText("全部类型");

                    /**
                     * 展示页面面板（最后要注释掉）
                     */
                    // traslationWantBuyCardJapel.getCardLayout().show(
                    // traslationWantBuyCardJapel, "zhaohuanshou");

                    break;

                case 9:

                    traslationWantBuyJpanel.getShouye().setIcons(CutButtonImage.cuts("inkImg/number/b4/B01a.png"));
                    traslationWantBuyJpanel.getDahuabi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B02a.png"));
                    traslationWantBuyJpanel.getDaoju().setIcons(CutButtonImage.cuts("inkImg/number/b4/B03a.png"));
                    traslationWantBuyJpanel.getZhaohuansou().setIcons(CutButtonImage.cuts("inkImg/number/b4/B04a.png"));
                    traslationWantBuyJpanel.getZhuangbei().setIcons(CutButtonImage.cuts("inkImg/number/b4/B05.png"));
                    traslationWantBuyJpanel.getLingbao().setIcons(CutButtonImage.cuts("inkImg/number/b4/B06a.png"));
                    traslationWantBuyJpanel.getGongshiqi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B07a.png"));
                    traslationWantBuyJpanel.getShoucang().setIcons(CutButtonImage.cuts("inkImg/number/b4/B08a.png"));
                    traslationWantBuyJpanel.changeOrder();
                    /**
                     * 将搜索信息传给服务器 1、初始化协议 2、修改搜索类型(0、首页最新上架页面 1、首页 2、大话币 3、道具 4、召唤兽
                     * 5、装备 6、灵宝 7、公示期 8、收藏 9、我要卖之已寄售品) 3、确认是否有二级搜索( 1 全部 2 召唤兽装备 3
                     * 地煞星符 4 宝石 5 召唤兽饰品 6 孩子装备 7 其它 8 1-14称 9 特殊召唤兽 10 高级守护 11 神兽
                     * 12 常规装备 13 神兵 14 仙器 15 配饰 16 护身符 17 灵宝 18 符石 19 道具类 20 召唤兽类
                     * 21 装备类 22 灵宝类 0 没有二级分类 ) 4、搜索条件的整合 5、转换为json字符串 6、上传给服务器
                     *
                     * start
                     */
                    searchGoodsBean.setSaletype(5);
                    searchGoodsBean.setContiontype("0");// 根据第一个下拉框改变
                    // searchGoodsBean.setSalename("种类=||要求=");
                    TraslationWantBuyZhaungbeiJpanel.getTraslationWantBuyZhaungbeiJpanel().setDangqianyeshu(1);
                    searchGoodsBean.setPageNum(1);
                    sendmes = Agreement.getAgreement().searchGoodsAgreement(
                            GsonUtil.getGsonUtil().getgson().toJson(searchGoodsBean));
                    SendMessageUntil.toServer(sendmes);
                    TrslationMainJframe.getTrslationMainJframe().setPanelOpen(5);
                    /**
                     * end
                     */
                    // 重置下拉框
                    TraslationWantBuyZhaungbeiJpanel.getTraslationWantBuyZhaungbeiJpanel().getChooseZbType().setText("全部");
                    /**
                     * 展示页面面板（最后要注释掉）
                     */
                    // traslationWantBuyCardJapel.getCardLayout().show(
                    // traslationWantBuyCardJapel, "zhuangbei");

                    break;

                case 10:

                    traslationWantBuyJpanel.getShouye().setIcons(CutButtonImage.cuts("inkImg/number/b4/B01a.png"));
                    traslationWantBuyJpanel.getDahuabi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B02a.png"));
                    traslationWantBuyJpanel.getDaoju().setIcons(CutButtonImage.cuts("inkImg/number/b4/B03a.png"));
                    traslationWantBuyJpanel.getZhaohuansou().setIcons(CutButtonImage.cuts("inkImg/number/b4/B04a.png"));
                    traslationWantBuyJpanel.getZhuangbei().setIcons(CutButtonImage.cuts("inkImg/number/b4/B05a.png"));
                    traslationWantBuyJpanel.getLingbao().setIcons(CutButtonImage.cuts("inkImg/number/b4/B06.png"));
                    traslationWantBuyJpanel.getGongshiqi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B07a.png"));
                    traslationWantBuyJpanel.getShoucang().setIcons(CutButtonImage.cuts("inkImg/number/b4/B08a.png"));
                    traslationWantBuyJpanel.changeOrder();
                    /**
                     * 点击灵宝按钮获取数据并展示 将搜索信息传给服务器 1、初始化协议 2、修改搜索类型(0、首页最新上架页面 1、首页
                     * 2、大话币 3、道具 4、召唤兽 5、装备 6、灵宝 7、公示期 8、收藏 9、我要卖之已寄售品)
                     * 3、确认是否有二级搜索( 0 全部 1 召唤兽装备 2 地煞星符 3 宝石 4 召唤兽饰品5 孩子装备6 其它 7
                     * 1-14称 8 特殊召唤兽 9 高级守护 10 神兽 11 常规装备 12 神兵 13 仙器 14 配饰 15 护身符
                     * 16 灵宝 17 符石 18 道具类 19 召唤兽类 20 装备类 21 灵宝类 0 没有二级分类 )▲全部减一
                     * 4、传递当前页码 5、搜索条件的整合 6、转换为json字符串 7、上传给服务器
                     *
                     * start
                     */
                    searchGoodsBean.setSaletype(6);
                    // searchGoodsBean.setContiontype("16");// 根据第一个下拉框改变
                    // searchGoodsBean.setSalename("等级=0级-200级");
                    TraslationWantBuyLingbaoJpanel.getTraslationWantBuyLingbaoJpanel().setDangqianyeshu(1);
                    searchGoodsBean.setPageNum(1);
                    sendmes = Agreement.getAgreement().searchGoodsAgreement(
                            GsonUtil.getGsonUtil().getgson().toJson(searchGoodsBean));
                    SendMessageUntil.toServer(sendmes);
                    TrslationMainJframe.getTrslationMainJframe().setPanelOpen(6);
                    /**
                     * end
                     */

                    /**
                     * 展示页面面板（最后要注释掉）
                     */
                    // traslationWantBuyCardJapel.getCardLayout().show(
                    // traslationWantBuyCardJapel, "lingbao");

                    break;

                case 11:

                    traslationWantBuyJpanel.getShouye().setIcons(CutButtonImage.cuts("inkImg/number/b4/B01a.png"));
                    traslationWantBuyJpanel.getDahuabi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B02a.png"));
                    traslationWantBuyJpanel.getDaoju().setIcons(CutButtonImage.cuts("inkImg/number/b4/B03a.png"));
                    traslationWantBuyJpanel.getZhaohuansou().setIcons(CutButtonImage.cuts("inkImg/number/b4/B04a.png"));
                    traslationWantBuyJpanel.getZhuangbei().setIcons(CutButtonImage.cuts("inkImg/number/b4/B05a.png"));
                    traslationWantBuyJpanel.getLingbao().setIcons(CutButtonImage.cuts("inkImg/number/b4/B06a.png"));
                    traslationWantBuyJpanel.getGongshiqi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B07.png"));
                    traslationWantBuyJpanel.getShoucang().setIcons(CutButtonImage.cuts("inkImg/number/b4/B08a.png"));
                    traslationWantBuyJpanel.changeOrder();
                    /**
                     * 点击消息按钮获取数据并展示 将搜索信息传给服务器 1、初始化协议 2、修改搜索类型(0、首页最新上架页面 1、首页
                     * 2、大话币 3、道具 4、召唤兽 5、装备 6、灵宝 7、公示期 8、收藏 9、我要卖之已寄售品)
                     * 3、确认是否有二级搜索( 1 全部 2 召唤兽装备 3 地煞星符 4 宝石 5 召唤兽饰品 6 孩子装备 7 其它 8
                     * 1-14称 9 特殊召唤兽 10 高级守护 11 神兽 12 常规装备 13 神兵 14 仙器 15 配饰 16 护身符
                     * 17 灵宝 18 符石 19 道具类 20 召唤兽类 21 装备类 22 灵宝类 0 没有二级分类 ) 4、传当前页码
                     * 5、搜索条件的整合 6、转换为json字符串 7、上传给服务器
                     *
                     * start
                     */
                    // searchGoodsBean.setSaletype(TreasurePavilionSearchUntil
                    // .GetPublicNoticePeriod(chooseLeft.getText()));
                    // searchGoodsBean.setContiontype("0");// 根据第一个下拉框改变
                    TraslationWantBuyGongshiqiJpanel.getTraslationWantBuyGongshiqiJpanel().setDangqianyeshu(1);
                    searchGoodsBean.setPageNum(1);
                    searchGoodsBean.setShow(2);
                    sendmes = Agreement.getAgreement().searchGoodsAgreement(
                            GsonUtil.getGsonUtil().getgson().toJson(searchGoodsBean));
                    SendMessageUntil.toServer(sendmes);
                    TrslationMainJframe.getTrslationMainJframe().setPanelOpen(7);
                    /**
                     * end
                     */
                    // 重置下拉框内容
                    TraslationWantBuyGongshiqiJpanel.getTraslationWantBuyGongshiqiJpanel().getChooseLeft().setText("全部");
                    /**
                     * 展示页面面板（最后要注释掉）
                     */
                    // traslationWantBuyCardJapel.getCardLayout().show(
                    // traslationWantBuyCardJapel, "gongshiqi");

                    break;

                case 12:

                    traslationWantBuyJpanel.getShouye().setIcons(CutButtonImage.cuts("inkImg/number/b4/B01a.png"));
                    traslationWantBuyJpanel.getDahuabi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B02a.png"));
                    traslationWantBuyJpanel.getDaoju().setIcons(CutButtonImage.cuts("inkImg/number/b4/B03a.png"));
                    traslationWantBuyJpanel.getZhaohuansou().setIcons(CutButtonImage.cuts("inkImg/number/b4/B04a.png"));
                    traslationWantBuyJpanel.getZhuangbei().setIcons(CutButtonImage.cuts("inkImg/number/b4/B05a.png"));
                    traslationWantBuyJpanel.getLingbao().setIcons(CutButtonImage.cuts("inkImg/number/b4/B06a.png"));
                    traslationWantBuyJpanel.getGongshiqi().setIcons(CutButtonImage.cuts("inkImg/number/b4/B07a.png"));
                    traslationWantBuyJpanel.getShoucang().setIcons(CutButtonImage.cuts("inkImg/number/b4/B08.png"));
                    traslationWantBuyJpanel.changeOrder();
                    /**
                     * 点击收藏按钮获取数据并展示
                     */
                    /**
                     * 将搜索信息传给服务器 1、初始化协议 2、修改搜索类型(0、首页最新上架页面 1、首页 2、大话币 3、道具 4、召唤兽
                     * 5、装备 6、灵宝 7、公示期 8、收藏 9、我要卖之已寄售品) 3、确认是否有二级搜索( 1 全部 2 召唤兽装备 3
                     * 地煞星符 4 宝石 5 召唤兽饰品 6 孩子装备 7 其它 8 1-14称 9 特殊召唤兽 10 高级守护 11 神兽
                     * 12 常规装备 13 神兵 14 仙器 15 配饰 16 护身符 17 灵宝 18 符石 19 道具类 20 召唤兽类
                     * 21 装备类 22 灵宝类 0 没有二级分类 ) 4、传递当前页数 5、搜索条件的整合 6、转换为json字符串
                     * 7、上传给服务器
                     *
                     * start
                     */

                    // searchGoodsBean.setSaletype(8);
                    // searchGoodsBean.setContiontype("");// 根据第一个下拉框改变
                    // searchGoodsBean.setPageNum(1);
                    sendmes = Agreement.getAgreement().searchCollectionQueryAgreement("1");
                    SendMessageUntil.toServer(sendmes);
                    TrslationMainJframe.getTrslationMainJframe().setPanelOpen(8);
                    /**
                     * end
                     */

                    /**
                     * 展示页面面板（最后要注释掉）
                     */
                    // traslationWantBuyCardJapel.getCardLayout().show(
                    // traslationWantBuyCardJapel, "shoucang");

                    break;
                case 13:
                    traslationWantBuyShouyeJpanel.getChooseLeftModel().setVisible(
                            !traslationWantBuyShouyeJpanel.getChooseLeftModel().isVisible());
                    break;
                case 14:
                    traslationWantBuyShouyeJpanel.getChooseRightModel().setVisible(
                            !traslationWantBuyShouyeJpanel.getChooseRightModel().isVisible());
                    break;
                case 15:
                    /**
                     * 上传数据到服务器中搜索数据
                     */
                    searchGoodsBean.setSaletype((traslationWantBuyShouyeJpanel
                            .getOpenType() == 1 ? null : traslationWantBuyShouyeJpanel
                            .getOpenType()));
                    if (traslationWantBuyShouyeJpanel.getOpenType() != 2) {
                        /**
                         * 判断空输入
                         */
                        if ("关键字或者ID"
                                .equals(traslationWantBuyShouyeJpanel.getjTextField().getText())
                                || "".equals(traslationWantBuyShouyeJpanel.getjTextField()
                                .getText().trim())) {
                            return;
                        }
                        searchGoodsBean.setSalename(traslationWantBuyShouyeJpanel
                                .getjTextField().getText().trim());
                    } else {
                        searchGoodsBean.setContiontype(TraslationWantBuyShouyeJpanel
                                .changeMath(traslationWantBuyShouyeJpanel
                                        .getChooseLeft().getText())
                                + "-"
                                + TraslationWantBuyShouyeJpanel.changeMath(traslationWantBuyShouyeJpanel.getChooseRight().getText()));
                    }
                    TraslationWantBuyShouyeJpanel.searchGoodsBean = searchGoodsBean;
                    TraslationWantBuyShouyeJpanel.souyeSousuo(1, 0, 0, TraslationWantBuyShouyeJpanel.searchGoodsBean);
                    break;
                case 16:

                    traslationWantBuyShouyeSousuojieguoJpanel.setShowOrder(0);
                    traslationWantBuyShouyeSousuojieguoJpanel.getUpSort().setIcon(
                            CutButtonImage.getImage("inkImg/old/1/Z1002.png", 10, 18));
                    traslationWantBuyShouyeSousuojieguoJpanel.getDownSort().setIcon(
                            CutButtonImage.getImage("inkImg/old/1/Z1004.png", 10, 18));
                    traslationWantBuyShouyeSousuojieguoJpanel.getShowperioditems().setIcon(null);
                    traslationWantBuyShouyeSousuojieguoJpanel.setShowperioditemsFlag(0);
                    TraslationWantBuyShouyeCardJpanel traslationWantBuyShouyeCardJpanel = TrslationMainJframe.getTrslationMainJframe().getTrslationMainJpanel().getTranslationMainCardJpanel().getTraslationWantBuyJpanel().getTraslationWantBuyCardJapel().getTraslationWantBuyShouyeCardJpanel();
                    traslationWantBuyShouyeCardJpanel.getCardLayout()
                            .show(traslationWantBuyShouyeCardJpanel, "sousuo");

                    break;
                case 17:

                    // TODO Auto-generated method stub
                    if (traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu() != 1) {
                        traslationWantBuyShouyeSousuojieguoJpanel.setDangqianyeshu(1);
                        traslationWantBuyShouyeSousuojieguoJpanel.getYema().setText(
                                traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu() + "/"
                                        + traslationWantBuyShouyeSousuojieguoJpanel.getZuidayema());
                        /**
                         * 上传数据到服务器中搜索数据
                         */
                        TraslationWantBuyShouyeJpanel.souyeSousuo(
                                traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu(),
                                traslationWantBuyShouyeSousuojieguoJpanel.getShowperioditemsFlag(),
                                traslationWantBuyShouyeSousuojieguoJpanel.getShowOrder(),
                                TraslationWantBuyShouyeJpanel.searchGoodsBean);

                    } else {
                        ZhuFrame.getZhuJpanel().addPrompt2("已在首页");
                    }

                    break;
                case 18:

                    // TODO Auto-generated method stub
                    if (traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu() > 1) {
                        traslationWantBuyShouyeSousuojieguoJpanel
                                .setDangqianyeshu(traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu() - 1);
                        ;
                        traslationWantBuyShouyeSousuojieguoJpanel.getYema().setText(
                                traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu() + "/"
                                        + traslationWantBuyShouyeSousuojieguoJpanel.getZuidayema());
                        /**
                         * 上传数据到服务器中搜索数据
                         */
                        TraslationWantBuyShouyeJpanel.souyeSousuo(
                                traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu(),
                                traslationWantBuyShouyeSousuojieguoJpanel.getShowperioditemsFlag(),
                                traslationWantBuyShouyeSousuojieguoJpanel.getShowOrder(),
                                TraslationWantBuyShouyeJpanel.searchGoodsBean);
                    } else {
                        ZhuFrame.getZhuJpanel().addPrompt2("已经没有上一页了");
                    }

                    break;
                case 19:

                    // TODO Auto-generated method stub
                    if (traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu() != traslationWantBuyShouyeSousuojieguoJpanel
                            .getZuidayema()) {
                        traslationWantBuyShouyeSousuojieguoJpanel
                                .setDangqianyeshu(traslationWantBuyShouyeSousuojieguoJpanel.getZuidayema());
                        traslationWantBuyShouyeSousuojieguoJpanel.getYema().setText(
                                traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu() + "/"
                                        + traslationWantBuyShouyeSousuojieguoJpanel.getZuidayema());
                        /**
                         * 上传数据到服务器中搜索数据
                         */
                        TraslationWantBuyShouyeJpanel.souyeSousuo(
                                traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu(),
                                traslationWantBuyShouyeSousuojieguoJpanel.getShowperioditemsFlag(),
                                traslationWantBuyShouyeSousuojieguoJpanel.getShowOrder(),
                                TraslationWantBuyShouyeJpanel.searchGoodsBean);

                    } else {
                        ZhuFrame.getZhuJpanel().addPrompt2("已在末页");
                    }

                    break;
                case 20:

                    // TODO Auto-generated method stub
                    if (traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu() < traslationWantBuyShouyeSousuojieguoJpanel
                            .getZuidayema()) {
                        traslationWantBuyShouyeSousuojieguoJpanel
                                .setDangqianyeshu(traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu() + 1);
                        traslationWantBuyShouyeSousuojieguoJpanel.getYema().setText(
                                traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu() + "/"
                                        + traslationWantBuyShouyeSousuojieguoJpanel.getZuidayema());
                        /**
                         * 上传数据到服务器中搜索数据
                         */
                        TraslationWantBuyShouyeJpanel.souyeSousuo(
                                traslationWantBuyShouyeSousuojieguoJpanel.getDangqianyeshu(),
                                traslationWantBuyShouyeSousuojieguoJpanel.getShowperioditemsFlag(),
                                traslationWantBuyShouyeSousuojieguoJpanel.getShowOrder(),
                                TraslationWantBuyShouyeJpanel.searchGoodsBean);
                    } else {
                        ZhuFrame.getZhuJpanel().addPrompt2("已经没有下一页了");
                    }

                    break;

                // case 30 ://摆摊面板的出售按钮
                // boothBoxMainJpanel.getBoothBoxBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/5.png"));
                // boothBoxMainJpanel.getPurchaseBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/6.png"));
                //
                // boothBoxMainJpanel.getBoothBoxCardJpanel().getCardLayout().show(boothBoxMainJpanel.getBoothBoxCardJpanel(),
                // "boothBox");
                // break;
                // case 31 ://摆摊面板的收购按钮
                // boothBoxMainJpanel.getBoothBoxBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/6.png"));
                // boothBoxMainJpanel.getPurchaseBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/5.png"));
                //
                // boothBoxMainJpanel.getBoothBoxCardJpanel().getCardLayout().show(boothBoxMainJpanel.getBoothBoxCardJpanel(),
                // "purchase");
                // break;
                // case 32 :
                // boothBoxJpanel.getZhaohuanshouBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/4.png"));
                // boothBoxJpanel.getLingbaoBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/3.png"));
                //
                // break;
                // case 33 :
                // boothBoxJpanel.getZhaohuanshouBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/3.png"));
                // boothBoxJpanel.getLingbaoBtn().setIcons(CutButtonImage.cuts("skin/8100226/button/4.png"));
                //
                // break;
                default:
                    break;
            }
        } catch (Exception e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    }

}
